package com.android.yinghebike.bean;

import com.blankj.utilcode.util.ConvertUtils;

import java.nio.ByteBuffer;

//给设备发的导航数据
public class BleNavInfo {

    public byte direction;   //方向
    public int nextStepDistance;   //到下个转弯距离. 4位
    public int destinationRemainingDistance; //剩余总距离   4位
    public int altitude;   //海拔
    public byte temperature; //气温

    public byte[] crateData() {
        byte[] arr = new byte[12];
        arr[0] = direction;

        arr[1] = (byte) ((nextStepDistance >> 24) & 0xFF);
        arr[2] = (byte) ((nextStepDistance >> 16) & 0xFF);
        arr[3] = (byte) ((nextStepDistance >> 8) & 0xFF);
        arr[4] = (byte) ((nextStepDistance) & 0xFF);

        arr[5] = (byte) ((destinationRemainingDistance >> 24) & 0xFF);
        arr[6] = (byte) ((destinationRemainingDistance >> 16) & 0xFF);
        arr[7] = (byte) ((destinationRemainingDistance >> 8) & 0xFF);
        arr[8] = (byte) ((destinationRemainingDistance) & 0xFF);

        arr[9] = (byte) ((altitude >> 8) & 0xFF);
        arr[10] = (byte) ((altitude) & 0xFF);

        arr[11] = temperature;
        return arr;
    }



}
